# from flask import url_for
# from flask_restful import Resource
# from werkzeug.security import check_password_hash
# from werkzeug.utils import redirect
# from restful.parser import RP_User_All
# from restful.response import ResponseNotFound, ResponseUnauthorized
# from models import User, QueryOneInstance
#
# def login(url):
#     parser = RP_User_All()
#     args = parser.parse_args()
#
#     user = QueryOneInstance(User, {'username': args['username']})
#
#     if not user:
#         return ResponseNotFound("用户不存在或已注销")
#
#     if not check_password_hash(user.password, args['password']):
#         return ResponseUnauthorized("密码错误")
#
#     return redirect(url)
#
#
# class CommonUserLogin(Resource):
#     def post(self):
#         #TODO
#         return login(url_for('login'))
#
# class AdminUserLogin(Resource):
#     def post(self):
#         #TODO
#         return login(url_for('login'))




